{"ast":null,"code":"import _slicedToArray from \"@babel/runtime/helpers/esm/slicedToArray\";\nimport ResizeObserver from 'resize-observer-polyfill';\nimport contains from \"rc-util/es/Dom/contains\";\nexport function isSamePoint(prev, next) {\n  if (prev === next) return true;\n  if (!prev || !next) return false;\n  if ('pageX' in next && 'pageY' in next) {\n    return prev.pageX === next.pageX && prev.pageY === next.pageY;\n  }\n  if ('clientX' in next && 'clientY' in next) {\n    return prev.clientX === next.clientX && prev.clientY === next.clientY;\n  }\n  return false;\n}\nexport function restoreFocus(activeElement, container) {\n  // Focus back if is in the container\n  if (activeElement !== document.activeElement && contains(container, activeElement) && typeof activeElement.focus === 'function') {\n    activeElement.focus();\n  }\n}\nexport function monitorResize(element, callback) {\n  var prevWidth = null;\n  var prevHeight = null;\n  function onResize(_ref) {\n    var _ref2 = _slicedToArray(_ref, 1),\n      target = _ref2[0].target;\n    if (!document.documentElement.contains(target)) return;\n    var _target$getBoundingCl = target.getBoundingClientRect(),\n      width = _target$getBoundingCl.width,\n      height = _target$getBoundingCl.height;\n    var fixedWidth = Math.floor(width);\n    var fixedHeight = Math.floor(height);\n    if (prevWidth !== fixedWidth || prevHeight !== fixedHeight) {\n      // https://webkit.org/blog/9997/resizeobserver-in-webkit/\n      Promise.resolve().then(function () {\n        callback({\n          width: fixedWidth,\n          height: fixedHeight\n        });\n      });\n    }\n    prevWidth = fixedWidth;\n    prevHeight = fixedHeight;\n  }\n  var resizeObserver = new ResizeObserver(onResize);\n  if (element) {\n    resizeObserver.observe(element);\n  }\n  return function () {\n    resizeObserver.disconnect();\n  };\n}","map":{"version":3,"names":["_slicedToArray","ResizeObserver","contains","isSamePoint","prev","next","pageX","pageY","clientX","clientY","restoreFocus","activeElement","container","document","focus","monitorResize","element","callback","prevWidth","prevHeight","onResize","_ref","_ref2","target","documentElement","_target$getBoundingCl","getBoundingClientRect","width","height","fixedWidth","Math","floor","fixedHeight","Promise","resolve","then","resizeObserver","observe","disconnect"],"sources":["/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/rc-align/es/util.js"],"sourcesContent":["import _slicedToArray from \"@babel/runtime/helpers/esm/slicedToArray\";\nimport ResizeObserver from 'resize-observer-polyfill';\nimport contains from \"rc-util/es/Dom/contains\";\nexport function isSamePoint(prev, next) {\n  if (prev === next) return true;\n  if (!prev || !next) return false;\n\n  if ('pageX' in next && 'pageY' in next) {\n    return prev.pageX === next.pageX && prev.pageY === next.pageY;\n  }\n\n  if ('clientX' in next && 'clientY' in next) {\n    return prev.clientX === next.clientX && prev.clientY === next.clientY;\n  }\n\n  return false;\n}\nexport function restoreFocus(activeElement, container) {\n  // Focus back if is in the container\n  if (activeElement !== document.activeElement && contains(container, activeElement) && typeof activeElement.focus === 'function') {\n    activeElement.focus();\n  }\n}\nexport function monitorResize(element, callback) {\n  var prevWidth = null;\n  var prevHeight = null;\n\n  function onResize(_ref) {\n    var _ref2 = _slicedToArray(_ref, 1),\n        target = _ref2[0].target;\n\n    if (!document.documentElement.contains(target)) return;\n\n    var _target$getBoundingCl = target.getBoundingClientRect(),\n        width = _target$getBoundingCl.width,\n        height = _target$getBoundingCl.height;\n\n    var fixedWidth = Math.floor(width);\n    var fixedHeight = Math.floor(height);\n\n    if (prevWidth !== fixedWidth || prevHeight !== fixedHeight) {\n      // https://webkit.org/blog/9997/resizeobserver-in-webkit/\n      Promise.resolve().then(function () {\n        callback({\n          width: fixedWidth,\n          height: fixedHeight\n        });\n      });\n    }\n\n    prevWidth = fixedWidth;\n    prevHeight = fixedHeight;\n  }\n\n  var resizeObserver = new ResizeObserver(onResize);\n\n  if (element) {\n    resizeObserver.observe(element);\n  }\n\n  return function () {\n    resizeObserver.disconnect();\n  };\n}"],"mappings":"AAAA,OAAOA,cAAc,MAAM,0CAA0C;AACrE,OAAOC,cAAc,MAAM,0BAA0B;AACrD,OAAOC,QAAQ,MAAM,yBAAyB;AAC9C,OAAO,SAASC,WAAW,CAACC,IAAI,EAAEC,IAAI,EAAE;EACtC,IAAID,IAAI,KAAKC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